package com.tygz.controller;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.auto.base.pojo.SysBasedata;
import com.auto.base.service.SysBasedataService;
import com.auto.common.BaseController;
import com.base.common.RequestParameters;
import com.base.model.interfaze.FieldAppendArray;
import com.base.util.JUtil;
import com.tygz.util.JtargetUtil;



@Controller
@RequestMapping("/sys/SysBaseExtdata")
public class SysBasedataExtController extends BaseController {

	private final Logger log = LoggerFactory.getLogger(SysBasedataExtController.class);
  @Resource
    public  SysBasedataService service;



	/**
	 * 根据代理bean查询集合
	 * @return
	 */
	@RequestMapping(value = "list")
	@ResponseBody
	public Object list(@ModelAttribute final RequestParameters requestParameters,HttpServletRequest request) {
		try {
			FieldAppendArray appendArray = new FieldAppendArray();
			SysBasedata rec = new SysBasedata();
			if(!JUtil.isNull(requestParameters.getDataBaseCode())){
				rec.setBaseCode(requestParameters.getDataBaseCode());
			}
		    List<SysBasedata> list = 	service.listSysBasedata(rec, null, null, null);
		    return JtargetUtil.getDataBaseElementsList_(list);
		} catch (Exception e) {
			log.error(e.getMessage(), e);
			return setFail(""+e.getMessage());
		}
	}

}
